import { setScrollHeigth } from "$utils/table"

export default {
  data() {
    return {
      scroll: {
        loadingStatus: "more",
        trigger: false,
      }
    }
  },
  computed: {
    // 是否显示上拉加载内容
    displayLoadMore() {
      const length = this.dataGrid.data.length
      return length && length >= this.dataGrid.pagination.pageSize
    }
  },
  methods: {
    // 触底加载
    scrolltolower() {
      const { pageNum, sumPageNum } = this.dataGrid.pagination
      if (pageNum < sumPageNum) {
        this.searchForm.search(true)
        this.scroll.loadingStatus = "loading"
      } else {
        this.scroll.loadingStatus = "noMore"
      }
    },
    refresherrefresh() {
      this.scroll.trigger = true
      this.searchForm.search()
    },
    setScrollStyle() {
      return setScrollHeigth()
    },
  }
}
